#include "switch.h"

#include "delay.h"


unsigned char delayKeyPause(unsigned long ms) {
	
	unsigned char pause = 0;
	
	
	if(ms != 0) {
		while(ms--) {
		
			delay_ms(1);
			if(keyStop == 0) {
				delay_ms(50);
				if(keyStop == 0) {
					while(keyStop == 0);
					
					pause = 1;
					while(pause) {
						if(keyStop == 0) {
							delay_ms(50);
							if(keyStop == 0) {
								while(keyStop == 0);
								pause = 0;
								return 1;
							}
						}
					}
				}
			}
			
		}
	} else {
		pause = 1;
		while(pause) {
			if(keyStop == 0) {
				delay_ms(50);
				if(keyStop == 0) {
					while(keyStop == 0);
					pause = 0;
					return 1;
				}
			}
		}
	}
	
	
	return 0;
}

/* END OF FILE */
